/**
 * Created with JetBrains PhpStorm.
 * User: Administrator
 * Date: 12-8-24
 * Time: 下午4:54
 * To change this template use File | Settings | File Templates.
 */
document.write('<script type="text/javascript" src="http://tomduiyi.cn/js/common.js"></script>');
document.write('<script type="text/javascript" src="http://tomduiyi.cn/js/jquery.js"></script>');

var html = '<div class="top1">\
                <div class="top_bar"><form style="display:none" id="_before_login"name="_login" method="POST" action="http://tomduiyi.cn/user/login/submit">\
                    <div class="top_bar_left">\
                        欢迎来到棋圣道场！\
                        <select name="account_type" id="account_type"> <option value="0">账号</option> <option value="3">昵称</option> </select>\
                        <input type="text" size="10" class="input1" name="username"/>\
                        密码：<input type="password" size="10" class="input1" name="password"/>\
                        <input onclick="document.forms[\'_login\'].submit()" type="button" class="button1"/>\
                        <a href="http://tomduiyi.cn/user/register/">注册</a></div></form>\
                    <div style="display:none" id="_after_login" class="top_bar_left">欢迎来到TOM对弈！ </div>\
                    <div class="top_bar_right">\
                        <a href="http://tomduiyi.cn/download/index" target="_blank">下载</a> |\
						<a href="http://www.tomduiyi.cn/pay/index?pay_type=wsyh" target="_blank">充值</a> |\
                        <a href="http://bbs.365weiqi.com" target="_blank">论坛</a> |\
                        <a href="#">纠纷处理</a> |\
                        <a href="javascript:void(0);" onclick="wq.setHomepage()">设为首页</a> |\
                        <a href="javascript:void(0);" onclick="wq.addFavorite()">加入收藏</a>\
                    </div>\
                </div>\
            </div>';

document.write(html);

$(function($) {
    wq.jsonp('user/api/userinfo', {}, function(data){
        if(typeof(data.passport) !== 'undefined')
        {
            $('#_after_login').append('<a href="http://tomduiyi.cn/user/center" title="用户中心">'+data.passport+'</a> <a href="http://tomduiyi.cn/user/logout" title="退出登陆">退出</a>').fadeIn();
        }
        else
        {
            $('#_before_login').fadeIn();
        }
    })
});